package com.hyh.toyshopping.service.impl;

import com.hyh.toyshopping.mapper.ToyMapper;
import com.hyh.toyshopping.model.Comment;
import com.hyh.toyshopping.model.Toy;
import com.hyh.toyshopping.model.view.CommentView;
import com.hyh.toyshopping.service.ToyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version 1.0
 * @BelongsProject:IntelliJ IDEA
 * @BelongsPackage:com.hyh.toyshopping.service.impl
 * @Author:hyhWTX
 * @ClassName:ToyServiceImpl
 * @CreateTime:2022年-12月-14日 20:15
 * @Description: 服务层注解，将当前类交给Spring进行管理
 */
@Service
public class ToyServiceImpl implements ToyService {

    @Autowired
    private ToyMapper toyMapper;
    @Override
    public List<Toy> getToys(int toy_is_display) {
        return toyMapper.queryToyAll(toy_is_display);
    }

    @Override
    public Toy getToyById(int toy_id) {
        return toyMapper.getToyById(toy_id);
    }

    @Override
    public List<CommentView> getToyComment(int toy_id) {
        return toyMapper.getToyComment(toy_id);
    }

    @Override
    public void addToyComment(Comment comment) {
        toyMapper.addToyComment(comment);
    }

    @Override
    public void updateToyDisplayStatus(int toy_id, int toy_is_display) {
        toyMapper.updateToyDisplayStatus(toy_id,toy_is_display);
    }

}
